﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace XOROperationinanArray
{
    public class Solution
    {
        public int XorOperation(int n, int start)
        {
            var result = 0;
            for (int i = 0; i < n; i++)
            {
                if (i == 0)
                {
                    result = start + 2 * i;
                }
                else
                {
                    result ^= start + 2 * i;
                }
            }

            return result;
        }
    }
}
